package com.msameer.gwttutor.client;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;

public class AppActivityMapper implements ActivityMapper {

    private ClientFactory clientFactory;

    public AppActivityMapper(ClientFactory clientFactory) {
        super();
        this.clientFactory = clientFactory;
    }

    @Override
    public Activity getActivity(Place place) {
        if (place instanceof CustomerPlace)
            return new CustomerActivity((CustomerPlace) place, clientFactory);
        else if (place instanceof HomePlace)
            return new HomeActivity((HomePlace) place, clientFactory);
        else if (place instanceof CustomersPlace)
            return new CustomersActivity((CustomersPlace) place, clientFactory);
        return null;
    }
}
